package com.djmw.mouse.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;

@Entity
@Table(name = "t_position_type")
@JsonAutoDetect(getterVisibility = Visibility.PUBLIC_ONLY)
public class PositionType extends IdEntity {
    private String name;
    private int order;
    private int level;
    private int level3PositionId;
    private int level2PositionId;
    private int level1PositionId;

    public PositionType() {
    }

    // JSR303 BeanValidator的校验规则
    @NotBlank
    @Column(name = "c_name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // JSR303 BeanValidator的校验规则
    @Min(100)
    @Column(name = "c_order")
    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    @Range(min = 1, max = 3)
    @Column(name = "c_level")
    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    @Column(name = "c_level3_id")
    public int getLevel3Id() {
        return level3PositionId;
    }

    public void setLevel3Id(int level3Id) {
        this.level3PositionId = level3Id;
    }

    @Column(name = "c_level2_id")
    public int getLevel2Id() {
        return level2PositionId;
    }

    public void setLevel2Id(int level2Id) {
        this.level2PositionId = level2Id;
    }

    @NotBlank
    @Column(name = "c_level1_id")
    public int getLevel1Id() {
        return level1PositionId;
    }

    public void setLevel1Id(int level1Id) {
        this.level1PositionId = level1Id;
    }
}
